package com.hlz.fastnote

import android.content.Context
import android.view.WindowManager
import kotlinx.android.synthetic.main.dialog_delete.*

class DeleteDialog(context: Context?) : BaseCenterDialog(context) {
    override val layout: Int
        protected get() = R.layout.dialog_delete

    override fun initView() {

        tvCancel.setOnClickListener {
            cancel()
        }

        tvSure.setOnClickListener {
            listener?.sure()
            cancel()
        }
    }

    var listener: OnDialogListener? = null
    fun setOnDialogListener(listener: OnDialogListener) {
        this.listener = listener
    }

    override fun setHeight(): Int {
        return WindowManager.LayoutParams.WRAP_CONTENT
    }

    override fun setWidth(): Int {
        return (super.setWidth()*0.8f).toInt()
    }

    interface OnDialogListener {
        fun sure()
    }
}